package com.wyh.mybatis.controller;

import com.wyh.mybatis.mapper.UserInfoMapper;
import com.wyh.mybatis.medol.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 王圆豪
 * Date: 2025-07-07
 * Time: 20:32
 */

@RestController
@RequestMapping("/UserInfo")
public class UserInfoController {
    @Autowired
    UserInfoMapper userInfoMapper;

    @RequestMapping("/getAllUserInfo")
    public List<UserInfo> getAllUserInfo(){
        return userInfoMapper.selectAll();
    }

    @RequestMapping("/getById")
    public UserInfo getById(Integer id){
        return userInfoMapper.selectById(id);
    }

    @RequestMapping("/quaryByNameAndPassword")
    public Boolean login(String name, String password){
        UserInfo userInfo = userInfoMapper.selectByNameAndPassword(name,password);
        if (userInfo != null) return true;
        return false;
    }

}
